<div class="order-list-page" ng-if="pagedata.op == 'list'">
    <div class="fui-header">
		<div class="fui-header-left" ng-click="goback()">
            <a class="back"></a>
        </div>
		<div class="title">我的任务</div>
		<div class="fui-header-right"></div>
	</div>
	<div style="margin-top:58px"></div>
	<div id="tab" class="fui-tab fui-tab-danger">
        <a ng-class="{'external active':pagedata.status == 0}" href="javascript:" ng-click="pagedata.status =0;tool.get_list('jy_ailiao/worker.worder/list/status=0',true)">待牵线</a>
        <a ng-class="{'external active':pagedata.status == 1}" href="javascript:" ng-click="pagedata.status =1;tool.get_list('jy_ailiao/worker.worder/list/status=1',true)">牵线中</a>
		<a ng-class="{'external active':pagedata.status == 2}" href="javascript:" ng-click="pagedata.status =2;tool.get_list('jy_ailiao/worker.worder/list/status=2',true)">已完成</a>
		<a ng-class="{'external active':pagedata.status == 7}" href="javascript:" ng-click="pagedata.status =7;tool.get_list('jy_ailiao/worker.worder/list/status=7',true)">异常报备</a>
    </div>
	<div class='fui-content' style="margin-top:4.4rem">
	<div style="padding:0.5rem">
	<div class="fui-cell-group radius" ng-repeat="item in pagedata.list">
                <div class="fui-cell" style="padding: 0.42rem 0.5rem">
                    <div class="fui-cell-info">
                        <div class="subtitle"> 任务号: {{item.ordersn}}</div>
                    </div>
					<div class="fui-cell-remark noremark">
						{{item.statustitle}}
					</div>
                </div> 
                 <div class="fui-cell">
						<div class="fui-cell-label" style="width:3.5rem" href="javascript:;" ng-click="access_json('jy_ailiao/memberitem//mid='+item.member.mid)">
							<img class="round" style="width:3rem;height:3rem;border-radius:3rem" ng-src="{{tomedia(item.member.avatar) || '../addons/jy_ailiao/resource/images/nologo.png'}}">
						</div>
						<div class="fui-cell-text" style="margin-top:0.16rem">
							<div class="title" style="font-size:0.76rem">
								<span class="bold" style="font-size:0.8rem;width:auto;margin-right:0.2rem">{{item.member.nickname || 0}}</span>
								<i ng-if="item.member.sex==2" class="icon icon-nv red"></i>
								<i ng-if="item.member.sex==1" class="icon icon-nan" style="color:#18bc9c"></i>
							</div>
							<div class="subtitle" style="font-size:0.65rem">
								{{item.member.city}} <span class="bold" style="color:#18bc9c">·</span> {{item.member.age || '**'}}岁 <span class="bold" style="color:#18bc9c">·</span> {{item.member.zhiwei || '**'}} <span class="bold" style="color:#18bc9c">·</span> {{item.member.height || '**'}}
							</div>
							<div class="subtitle" style="font-size:0.65rem">
								{{item.member.realname || '无真实姓名'}}
								<a href="tel:{{item.member.mobile}}" style="color:#18bc9c">{{item.member.mobile || '无电话'}}</a>
							</div>
						</div>
						<div class="fui-cellone-remark noremark">
							<span class="jylabel jylabel-success active" style="padding:0.3rem 0.6rem;border-radius:1rem;font-weight:400">约瓶方</span>
						</div>
					</div>
					<div class="fui-cell">
						<div class="fui-cell-label" style="width:3.5rem" href="javascript:;" ng-click="access_json('jy_ailiao/memberitem//mid='+item.tomember.mid)">
							<img class="round" style="width:3rem;height:3rem;border-radius:3rem" ng-src="{{tomedia(item.tomember.avatar) || '../addons/jy_ailiao/resource/images/nologo.png'}}">
						</div>
						<div class="fui-cell-text" style="margin-top:0.16rem">
							<div class="title" style="font-size:0.76rem">
								<span class="bold" style="font-size:0.8rem;width:auto;margin-right:0.2rem">{{item.tomember.nickname || 0}}</span>
								<i ng-if="item.tomember.sex==2" class="icon icon-nv red"></i>
								<i ng-if="item.tomember.sex==1" class="icon icon-nan" style="color:#18bc9c"></i>
							</div>
							<div class="subtitle" style="font-size:0.65rem">
								{{item.tomember.city}} <span class="bold" style="color:#18bc9c">·</span> {{item.tomember.age || '**'}}岁 <span class="bold" style="color:#18bc9c">·</span> {{item.tomember.zhiwei || '**'}} <span class="bold" style="color:#18bc9c">·</span> {{item.tomember.height || '**'}}
							</div>
							<div class="subtitle" style="font-size:0.65rem">
								{{item.tomember.realname || '无真实姓名'}}
								<a href="tel:{{item.tomember.mobile}}" style="color:#18bc9c">{{item.tomember.mobile || '无电话'}}</a>
							</div>
						</div>
						<div class="fui-cellone-remark noremark">
							<span class="jylabel jylabel-red active" style="padding:0.3rem 0.6rem;border-radius:1rem;font-weight:400">被约方</span>
						</div>
					</div>
					<div class="fui-cell-title r-f">
						<span ng-if="item.status==0" class="status noremark">
							<div class="btn btn-sm btn-danger-o order-finish" href="javascript:" ng-click="post({},'/worker.worder/status1/','id='+item.id)">已联系</div>
						</span>
						<span ng-if="item.status==1" class="status noremark">
							<div class="btn btn-sm btn-danger-o order-finish" href="javascript:" ng-click="post({},'/worker.worder/status2/','id='+item.id)">确认完成</div>
						</span>
						<span ng-if="item.status!=2" class="status noremark">
							<div class="btn btn-sm btn-success-o order-finish" href="javascript:" ng-click="pagedata.post.id=item.id;pagedata.showbaobei=true">异常报备</div>
						</span>
					</div>
        </div>
	</div>
	</div>
	<div class="content-empty" ng-show="pagedata.list.length == 0 ">
		  <i class="icon jinyunicon icon-cry" style="width: 6rem;margin-bottom: 0.5rem;"></i><br/><p style="color: #999;font-size: .75rem">您暂时没有任务！</p>
	</div>
</div>
<div ng-if="pagedata.showbaobei" class="popup">
	<div class="popup-body">
		<div class="popup-bottom">
			<i class="closed icon icon-cuowu" ng-click="pagedata.showbaobei=false"></i>
			<div class='fui-content' style="padding:0.5rem">
				<div class="title bold">异常报备 / <small>Reported</small></div>
				<div class="tips tips-yellow">
						<i class="fa fa-bullhorn alert-link"></i> 请选择需要报备的异常问题，报备内容将同步顾客及总部，请如实上报！
				</div>
				<div class="weui_cells weui_cells_radio2" style="margin-top:0.2rem">
						<label class="weui_cell weui_check_label dashed">
							<div class="weui_cell_bd weui_cell_primary">
								<span style="float:left;width:100%"><i class="icon icon-phone"></i> 联系不上约瓶方</span>
							</div>
							<div class="weui_cell_ft" href="javascript:;" ng-click="pagedata.post.remark='联系不上约瓶方'">
								<input type="radio" class="weui_check" name="radio1">
								<span class="weui_icon_checked"></span>
							</div>
						</label>
						<label class="weui_cell weui_check_label dashed">
							<div class="weui_cell_bd weui_cell_primary">
								<span style="float:left;width:100%"><i class="icon icon-phone"></i> 联系不上被约方</span>
							</div>
							<div class="weui_cell_ft" href="javascript:;" ng-click="pagedata.post.remark='联系不上被约方'">
								<input type="radio" class="weui_check" name="radio1">
								<span class="weui_icon_checked"></span>
							</div>
						</label>
						<label class="weui_cell weui_check_label dashed">
							<div class="weui_cell_bd weui_cell_primary">
								<span style="float:left;width:100%"><i class="icon icon-all"></i> 其他异常原因</span>
							</div>
							<div class="weui_cell_ft" href="javascript:;" ng-click="pagedata.post.msg=3">
								<input type="radio" class="weui_check" name="radio1">
								<span class="weui_icon_checked"></span>
							</div>
						</label>
				</div>
				<div class="weui_btn_area">
				 <a class="weui_btn weui_btn_primary" href="javascript:" id="showTooltips" ng-click="post(pagedata.post,'/worker.worder/baobei/');pagedata.showbaobei=false">提交</a>
				 </div>
			</div>
		</div>
	</div>
</div>
<div ng-include="sys_html('worker/_footer')"></div>
<div class="fe-floatright-bottom" style="bottom:5rem">
<a ng-if="pagedata.isopenvoice!=1" ng-click="pagedata.isopenvoice=1;pagedata.openvoice(true)" href="javascript:;"><i class="icon icon-nolingsheng0"></i></a>
<a ng-if="pagedata.isopenvoice==1" ng-click="pagedata.isopenvoice=0;pagedata.openvoice(false)" href="javascript:;"><i class="icon icon-lingsheng0"></i></a> 
</div>
<audio id="openvoice" controls preload="auto" style="display:none;">
	<source src="../core/resource/images/neworder.mp3"></source>
</audio>
<script type="text/javascript">
scope.pagedata.openLocation=function(item){
	var pcdaddress= item.pcd?item.pcd.province+item.pcd.city+item.pcd.district+item.pcd.street:'';
	var post={
		'address':pcdaddress+item.address,
		'city':item.pcd?item.pcd.city:''
	}
	scope.tool.get_latlng(post,function(res){
		var lat_lng = res.location
		var address_components = res.address_components
		wx.openLocation({
			latitude: lat_lng.lat, // 纬度，浮点数，范围为90 ~ -90
			longitude: lat_lng.lng, // 经度，浮点数，范围为180 ~ -180。
			name: pcdaddress, // 位置名
			address: item.address, // 地址详情说明
			scale: 20, // 地图缩放级别,整形值,范围从1~28。默认为最大
			infoUrl: '', // 在查看位置界面底部显示的超链接,可点击跳转
			success:function(){
				//alert(1111);
			},
			fail:function(res){
				scope.message('导航异常，可能是权限问题：'+res.errMsg);
			}
		});
	});
	
}
</script>
<script>
scope.tool.get_list('jy_ailiao/worker.worder/list/status='+scope.pagedata.status,true);
scope.pagedata.scroll_bottom=function(){
	scope.tool.get_list('jy_ailiao/worker.worder/list/status='+scope.pagedata.status);
}
scope.pagedata.openvoice=function(type){
	var voicetime = {};
    var openvoice;
	if(type || scope.pagedata.isopenvoice==1){
		 openvoice = setInterval(() => {
			if(scope.pagedata.isopenvoice!=1){
				clearInterval(openvoice);
				return false;
			}
			scope.get('jy_ailiao/worker.index/getnew/',function(res){
						console.log('openvoice');console.log(res);
						if(res!='none'){
							if(!voicetime[res.id]){
								voicetime[res.id]=1;
								$("#openvoice")[0].play();
							}
							if(scope.pagedata.status==2){
								scope.tool.get_list('jy_ailiao/worker.worder/list/status='+scope.pagedata.status,true);
							}
						}
			});
		}, 5000);
	}else{
		scope.get('jy_ailiao/worker.index/setopenvoice/isopenvoice=0',function(res){});
	}
}
scope.pagedata.openvoice();
</script>